package com.jpf.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jpf.demo.Order;
import com.jpf.service.OrderService;
@WebServlet("/QueryOrder.do")
public class QueryOrder extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		response.setContentType("text/html;charset=utf-8");
		request.setCharacterEncoding("utf-8");
		PrintWriter out = response.getWriter();
		OrderService orderService = new OrderService();
		List<Order> list1 = orderService.queryOrder();
		if (list1!=null)
		{
			request.getSession().setAttribute("list1", list1);
			response.sendRedirect("admin/order.jsp");  
		}else{
			response.sendRedirect("admin/error.jsp");
		}
	}
}
